package com.chtw.utils;

import com.chtw.entity.LoginAccount;

public class Result {
	private int code;//返回状态码，一般来说1表示成功，-1表示失败
	private String message;
	private Object data;//服务器返回给用户的的数据
	private int total;
	private int pages;
	
	
	
	public int getPages() {
		return pages;
	}
	public void setPages(int pages) {
		this.pages = pages;
	}
	public int getTotal() {
		return total;
	}
	public void setTotal(int total) {
		this.total = total;
	}
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	
	
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
	//默认方法
	public static Result seccess() {
		Result res = new Result();
		res.setCode(1);
		return res;
	}

	public static Result seccess(Object data) {
		Result res = new Result();
		res.setCode(1);
		res.setData(data);
		return res;
	}
	public static Result seccess(Object data,int pages,int total) {
		Result res = new Result();
		res.setPages(pages);
		res.setTotal(total);
		res.setCode(1);
		res.setData(data);
		return res;
	}
	public static Result fail(String msg) {
		Result res = new Result();
		res.setCode(-1);
		res.setMessage(msg);
		return res;
	}
	public static Result seccessTeach(Object data) {
		Result res = new Result();
		res.setCode(1);
		res.setData(data);
		return res;
	}
	public static Result seccessAdmin(Object data) {
		Result res = new Result();
		res.setCode(0);
		res.setData(data);
		return res;
	}
	public static Result seccessStu(Object data) {
		Result res = new Result();
		res.setCode(2);
		res.setData(data);
		return res;
	}
}
